#include "s3c2440_soc.h"

void delay(volatile int ms)
{
	while(ms--);
}

int main(void)
{
	int val1, val2;
	/* 设置 GPFCON 让 GPFCON4/5/6为 输出引脚*/
	GPFCON &= ~((3 << 8) | (3 << 10) | (3 << 12));
	GPFCON |=  ((1 << 8) | (1 << 10) | (1 << 12));

	/* 配置3个按键引脚为输入引脚 */
	/* GPF0(S2) GPF2(S3) GPG3(S4) */
	GPFCON &= ~(( 3 << 0) | (3 << 4));
	GPGCON &= ~(3 << 6);
		
	
	

	/* 循环点亮 */
	while (1)
	{
		val1 = GPFDAT;
		val2 = GPGDAT;

		if (val1 & (1 << 0)) /* s2 松开*/
		{
			GPFDAT |= (1 << 6);
		}
		else		     /* S2 按下*/
		{
			GPFDAT &= ~(1 << 6);
		}
		if (val1 & (1 << 2)) /* s3 松开*/
		{
			
			GPFDAT |= (1 << 5);
		}
		else		     /* S3 按下*/
		{
			
			GPFDAT &= ~(1 << 5);
		}
		if (val2 & (1 << 3)) /* s4 松开*/
		{
			
			GPFDAT |= (1 << 4);
		}
		else		     /* S4 按下*/
		{
			
			GPFDAT &= ~(1 << 4);
		}
	}
	return 0;
}
